import java.util.Arrays;

public class test6 {
    public String[] sortPeople(String[] names, int[] heights) {
        int n = names.length;
        Integer[] index = new Integer[n]; // 记录下标

        for (int i = 0; i < n; i++) {
            index[i] = i;
        }

        Arrays.sort(index,(i,j)->{
            return heights[j]-heights[i];
        });
        String[] result = new String[n];
        for (int i = 0; i < n; i++) {
            result[i] = names[index[i]];
        }
        return result;
    }
}
